package android.coocoo.models;

import android.os.Parcel;
import android.os.Parcelable;

public class CategoryInfo implements Parcelable{
	
	private int id;
	private String title;
	private static int count = 0;
	
	public CategoryInfo(Parcel in) {
	      readFromParcel(in);
	}
	
	public CategoryInfo(){
		super();
		this.id = count;
		this.title = new String("Category " + count);
		count++;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public int getId() {
		return id;
	}
	
	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getTitle() {
		return title;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(this.getId());
		dest.writeString(this.getTitle());
	}
	
	public static final Creator<CategoryInfo> CREATOR = new Creator<CategoryInfo>() {

	      public CategoryInfo createFromParcel(Parcel source) {
	         return new CategoryInfo(source);
	      }

	      public CategoryInfo[] newArray(int size) {
	         return new CategoryInfo[size];
	      }
	};

	private void readFromParcel(Parcel in) {
		this.id = in.readInt();
		this.title = in.readString();
	}
}
